/* Init process. First and only process started by the kernel. It is not favoured by it though. It runs with the highest priority (1) and has SYSTEM_ID as parent. It differs from the init in a regular Linux because it is not its own parent. Indeed, in PORN-OS, no process can have SYSTEM_ID as pid.
Its job is simple, starting some processes and making sure there at least a shell in the system. */

#include "init.h"

void init(){
  int status;
  int pid = fourchette(3, "scroller",NULL);
  if(pid < 0){
    ecrire("init couldn't start the scroller.\n");
    quitter(FAILURE);
  }
  while(1){
    pid = fourchette(10, "shell", NULL);
    if(pid < 0){
      ecrire("init couldn't start the shell\n");
      quitter(FAILURE);
    }
    attendre(pid,&status);
    ecrire("init has detected the shell it started just died. It will restart it\n");
  }
}
